package com.spring.demo5.eg1;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Map;

/**
 * @author vhans
 */
public class ConditionTest {

    @Test
    public void test1() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MainConfig1.class);
        Map<String, String> beanMap = context.getBeansOfType(String.class);
        beanMap.forEach((beanName, bean) -> {
            System.out.printf("%s->%s%n", beanName, bean);
        });
    }

    @Test
    public void test2() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MainConfig2.class);
        Map<String, String> beanMap = context.getBeansOfType(String.class);
        beanMap.forEach((beanName, bean) -> {
            System.out.printf("%s->%s%n", beanName, bean);
        });
    }
}
